package com.xiaomo.gitee.datamanager.mapper;
import com.xiaomo.gitee.datamanager.cache.MybatisRedisCache;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;

import org.apache.ibatis.annotations.*;

import java.util.List;

import com.xiaomo.gitee.datamanager.entity.Images;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

@Mapper
@CacheNamespace(implementation = MybatisRedisCache.class,eviction = MybatisRedisCache.class)
public interface ImagesMapper extends BaseMapper<Images> {

    @Override
    int insert(Images entity);

    Images selectAllById(@Param("id") String id);

    List<Images> selectAll();

    List<Images> selectAllByClassification(@Param("classification") Long classification);

    @Result(column = "sequence_number", property = "sequenceNumber")
    List<Images> selectAllByClassificationOrderByName(@Param("classification") Long classification);

    int insertBatch(@Param("imagesCollection") Collection<Images> imagesCollection);

    Images selectOneById(@Param("id") String id);

    int deleteByClassification(@Param("classification") Long classification);

    List<Images> selectByClassification(@Param("classification") Long classification);

    int deleteById(@Param("id") String id);

    @Result(column = "sequence_number", property = "sequenceNumber")
    List<Images> selectImagesWithRowNumber(
            @Param("category") Long category,
            @Param("startRow") long startRow,
            @Param("pageSize") long pageSize,
            @Param("orderBy") String orderBy
    );

    @Result(column = "sequence_number", property = "sequenceNumber")
    List<Images> selectImagesWithRowNumberWithoutPager(
            @Param("orderBy") String orderBy
    );

    @Select("select distinct classification from images")
    List<String> getAllCategories();

    List<Images> searchImagesByName(
            @Param("info") String info,
            @Param("orderBy") String orderBy
    );



}




